home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / MacScheme20 / Mathlib / udefs2.scm < prev    next >
Encoding:
Text File  |  1989-04-27  |  452 b   |  19 lines  |  [TEXT/????]

  1. ;;; $Header: udefs2.scm,v 1.3 88/01/26 07:45:30 GMT gjs Exp $
  2.  
  3. (if-mit
  4.  (declare (usual-integrations = + - * /
  5.                  zero? 1+ -1+
  6.                  ;; truncate round floor ceiling
  7.                  sqrt exp log sin cos)))
  8.  
  9. (define (square x) (* x x))
  10.  
  11. (define (close-enuf? h1 h2 tolerance)
  12.   (<= (abs (- h1 h2)) (* .5 tolerance (+ (abs h1) (abs h2) 2))))
  13.  
  14. (define (sigma f low high)
  15.   (let lp ((i low) (sum 0))
  16.     (if (> i high)
  17.         sum
  18.         (lp (1+ i) (+ sum (f i))))))
  19.